package designpatterns.prototype;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2022/1/29 8:40
 */
public abstract class Shape implements Cloneable {

    private static final Logger logger = LoggerFactory.getLogger(Shape.class);

    private String id;

    protected String type;

    abstract void draw();


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }


    /**
     * 重写 clone()
     *
     * @return Object
     */
    @Override
    protected Object clone() {
        Object clone = null;
        try {
            clone = super.clone();
        } catch (CloneNotSupportedException e) {
            logger.error(e.getMessage(),e);
        }
        return clone;
    }
}
